<?php
/**
 * @author: zhouzhongyuan <435690026@qq.com>
 * @copyright 万虎网络
 * @link http://www.wanhunet.com
 */

namespace common\lang;


class Boolean extends Lang
{
    const FALSE = false;
    const TRUE = true;
    const TYPE = 'boolen';




    public function get()
    {
        return $this->var;
    }

    public function set($var)
    {
        if (is_bool($var)) {
            $this->var = $var;
            return $this;
        } elseif ($var == "true" || $var == "1") {
            $this->var = self::TRUE;
            return $this;
        } elseif ($var == "false" || $var == "0") {
            $this->var = self::FALSE;
            return $this;
        } else {
            throw new \Exception("var should be boolen");
        }
    }

}